package com.question.business.dept.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.question.business.dept.entity.DeptPost;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 部门岗位Mapper接口
 *
 * @author star
 * @since 2023-09-14
 */
@Mapper
public interface DeptPostMapper extends BaseMapper<DeptPost> {

    /**
     * 部门岗位查询
     *
     * @param deptId 部门ID
     * @return List<String> 响应参数
     */
    @Select("SELECT post_id FROM t_dept_post WHERE dept_id = #{deptId}")
    List<String> queryPostByDeptId(String deptId);

    /**
     * 岗位部门查询
     *
     * @param postId 岗位ID
     * @return List<String> 响应参数
     */
    @Select("SELECT dept_id FROM t_dept_post WHERE post_id = #{postId}")
    List<String> queryDeptByPostId(String postId);

    /**
     * 根据部门ID删除岗位
     *
     * @param deptId 部门ID
     */
    @Delete("DELETE FROM t_dept_post WHERE dept_id = #{deptId}")
    void deleteByDeptId(String deptId);

    /**
     * 根据岗位ID删除部门
     *
     * @param postId 岗位ID
     */
    @Delete("DELETE FROM t_dept_post WHERE post_id = #{postId}")
    void deleteByPostId(String postId);

}